/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * BittorrentLike.java
 *
 * Created on Oct 5, 2013, 9:35:21 AM
 */
package GUI;

import broadcast.*;
import common.global;
import hashChunk.Chunk;
import hashChunk.TorrentFile;
import java.io.File;
import java.io.IOException;
import java.net.*;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.filechooser.FileNameExtensionFilter;
import managerPeer.NodeMap;
import managerPeer.ShareFile;

/**
 *
 * @author TuanLak
 */
public class BittorrentLike extends javax.swing.JFrame {

    MulticastSocket multicastSocket;
    myBroastcastListener alwaysListen;
    myBroastcastSender sender;
    InetAddress inetAddress;

    /** Creates new form BittorrentLike */
    public BittorrentLike() {
        initComponents();
        global.jframMain = (JFrame) this;
        global.nodes = new NodeMap(jlstListPeer);
        global.nodes.updateListPeerOntoGUI();

        global.shares = new ShareFile(jlstShared);
        global.shares.updateListChunkShareOntoGUI();

        global.torentFile = new TorrentFile(jlstDownLoad);
        System.out.println("Khoi tao Bittorent Like thanh cong ...");
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jLabel1 = new javax.swing.JLabel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jbtnJoinToLan = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jlstListPeer = new javax.swing.JList();
        jPanel3 = new javax.swing.JPanel();
        txtShare = new javax.swing.JTextField();
        jbtnBownseOFsharedFile = new javax.swing.JButton();
        jbtnShareOFsharedFile = new javax.swing.JButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        jlstShared = new javax.swing.JList();
        bntCancel = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jlstDownLoad = new javax.swing.JList();
        bntOpenTorrent = new javax.swing.JButton();
        jpanDownLoad = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();
        jLabel2 = new javax.swing.JLabel();
        bntDownload = new javax.swing.JButton();
        bntDownAll = new javax.swing.JButton();
        radioDownRandom = new javax.swing.JRadioButton();
        ridioChonPeer = new javax.swing.JRadioButton();
        bntCancelOpenTorrent = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getSize()+25f));
        jLabel1.setText("                  Bittorent Like");

        jbtnJoinToLan.setText("Join To LAN");
        jbtnJoinToLan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnJoinToLanActionPerformed(evt);
            }
        });

        jScrollPane1.setViewportView(jlstListPeer);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 631, Short.MAX_VALUE)
                    .addComponent(jbtnJoinToLan, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 631, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jbtnJoinToLan, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 432, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("List Peer", jPanel1);

        txtShare.setEditable(false);

        jbtnBownseOFsharedFile.setText("Browse");
        jbtnBownseOFsharedFile.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnBownseOFsharedFileActionPerformed(evt);
            }
        });

        jbtnShareOFsharedFile.setText("Shared");
        jbtnShareOFsharedFile.setEnabled(false);
        jbtnShareOFsharedFile.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtnShareOFsharedFileActionPerformed(evt);
            }
        });

        jScrollPane3.setViewportView(jlstShared);

        bntCancel.setText("Cancel");
        bntCancel.setEnabled(false);
        bntCancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bntCancelActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(txtShare, javax.swing.GroupLayout.PREFERRED_SIZE, 352, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtnBownseOFsharedFile)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jbtnShareOFsharedFile, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(bntCancel))
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 631, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtShare, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbtnBownseOFsharedFile, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbtnShareOFsharedFile, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bntCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 417, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(33, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Shared File", jPanel3);

        jlstDownLoad.setSelectedIndex(0);
        jScrollPane2.setViewportView(jlstDownLoad);

        bntOpenTorrent.setText("Open Torrent");
        bntOpenTorrent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bntOpenTorrentActionPerformed(evt);
            }
        });

        jList1.setEnabled(false);
        jScrollPane4.setViewportView(jList1);

        jLabel2.setText("Các peer có chunk");

        bntDownload.setText("Download");
        bntDownload.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bntDownloadActionPerformed(evt);
            }
        });

        bntDownAll.setText("Download All");

        javax.swing.GroupLayout jpanDownLoadLayout = new javax.swing.GroupLayout(jpanDownLoad);
        jpanDownLoad.setLayout(jpanDownLoadLayout);
        jpanDownLoadLayout.setHorizontalGroup(
            jpanDownLoadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpanDownLoadLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpanDownLoadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 264, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jpanDownLoadLayout.createSequentialGroup()
                        .addComponent(bntDownload)
                        .addGap(30, 30, 30)
                        .addComponent(bntDownAll)))
                .addContainerGap(33, Short.MAX_VALUE))
        );
        jpanDownLoadLayout.setVerticalGroup(
            jpanDownLoadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpanDownLoadLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpanDownLoadLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(bntDownload)
                    .addComponent(bntDownAll))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        buttonGroup1.add(radioDownRandom);
        radioDownRandom.setSelected(true);
        radioDownRandom.setText("Down ngẫu nhiên");

        buttonGroup1.add(ridioChonPeer);
        ridioChonPeer.setText("Chọn peer");

        bntCancelOpenTorrent.setText("Cancel");
        bntCancelOpenTorrent.setEnabled(false);
        bntCancelOpenTorrent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bntCancelOpenTorrentActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 631, Short.MAX_VALUE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(bntCancelOpenTorrent, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(bntOpenTorrent, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(67, 67, 67)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(radioDownRandom)
                            .addComponent(ridioChonPeer)))
                    .addComponent(jpanDownLoad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 201, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(radioDownRandom)
                            .addComponent(bntOpenTorrent, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(bntCancelOpenTorrent, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addComponent(ridioChonPeer)
                        .addGap(13, 13, 13)))
                .addGap(4, 4, 4)
                .addComponent(jpanDownLoad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(20, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("DownLoad File", jPanel2);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 656, Short.MAX_VALUE)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 656, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 526, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jbtnJoinToLanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnJoinToLanActionPerformed
        // TODO add your handling code here:
        //gửi 1 gói tin tham gia vào group
        myPackage.Package pk = new myPackage.Package();
        pk.setM_Option("[$TaoDaVaoRoom]");
        System.out.println("Tạo package TaoDaVaoRoom");
        try {
            multicastSocket = new MulticastSocket(global.port);
            System.out.println("global.port  " + global.port);
            inetAddress = InetAddress.getByName(global.LANgroup);
            multicastSocket.joinGroup(inetAddress);
            
            //vào group và luôn luôn lắng nghe từ các thành viên khác
            alwaysListen = new myBroastcastListener(multicastSocket, inetAddress, global.port);
            alwaysListen.start();
            System.out.println("Luon luon lang nghe peer khac thanh cong");

            //gửi các broastcast cho các thành viên khác
            sender = new myBroastcastSender(multicastSocket, inetAddress, global.port);
            sender.sendBroadcast(pk);

        } catch (IOException ex) {
            ex.printStackTrace();
            System.out.println(ex.getMessage());
        }
    }//GEN-LAST:event_jbtnJoinToLanActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        // TODO add your handling code here:
        if (multicastSocket != null) {
//            multicastSocket.close();
        }
    }//GEN-LAST:event_formWindowClosing
    File fileShare = null;
    private void jbtnBownseOFsharedFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnBownseOFsharedFileActionPerformed
        // TODO add your handling code here:
        JFileChooser fc = new JFileChooser("D:\\");

        int result = fc.showOpenDialog(this);
        fileShare = fc.getSelectedFile();
        if (fileShare != null
                && result == JFileChooser.APPROVE_OPTION) {
            System.out.println("file.getName() : " + fileShare.getName());
            System.out.println("file.getAbsolutePath() :" + fileShare.getAbsolutePath());
            txtShare.setText(fileShare.getName());

            jbtnShareOFsharedFile.setEnabled(true);
            bntCancel.setEnabled(true);
            jbtnBownseOFsharedFile.setEnabled(false);
        }
    }//GEN-LAST:event_jbtnBownseOFsharedFileActionPerformed

    private void bntCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bntCancelActionPerformed
        // TODO add your handling code here:
        fileShare = null;
        txtShare.setText(null);
        jbtnBownseOFsharedFile.setEnabled(true);
        bntCancel.setEnabled(false);
        jbtnShareOFsharedFile.setEnabled(false);
    }//GEN-LAST:event_bntCancelActionPerformed

    private void jbtnShareOFsharedFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtnShareOFsharedFileActionPerformed
        // TODO add your handling code here:
        try {
            global.shares.updateListShare(fileShare);
            fileShare = null;
            txtShare.setText(null);
            jbtnBownseOFsharedFile.setEnabled(true);
            bntCancel.setEnabled(false);
            jbtnShareOFsharedFile.setEnabled(false);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_jbtnShareOFsharedFileActionPerformed
    File torent = null;
    private void bntOpenTorrentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bntOpenTorrentActionPerformed
        // TODO add your handling code here:
        JFileChooser fc = new JFileChooser("share\\torent\\");
        fc.setFileFilter(new FileNameExtensionFilter("Torent files ( *.torrent )", "torrent"));
        int result = fc.showOpenDialog(this);
        torent = fc.getSelectedFile();
        if (torent != null
                && result == JFileChooser.APPROVE_OPTION) {
            global.torentFile.readFileTorrent(torent);
            bntCancelOpenTorrent.setEnabled(true);
            bntOpenTorrent.setEnabled(false);
        }
    }//GEN-LAST:event_bntOpenTorrentActionPerformed

    private void bntCancelOpenTorrentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bntCancelOpenTorrentActionPerformed
        // TODO add your handling code here:
        torent = null;
        global.torentFile.reset();
        bntCancelOpenTorrent.setEnabled(false);
        bntOpenTorrent.setEnabled(true);
    }//GEN-LAST:event_bntCancelOpenTorrentActionPerformed

    private void bntDownloadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bntDownloadActionPerformed
        // TODO add your handling code here:
        if (jlstDownLoad.getSelectedIndex() != -1) {
            Chunk chunk = global.torentFile.getChunkInList(jlstDownLoad.getSelectedValue().toString());

            myPackage.Package pk = new myPackage.Package();
            pk.setM_Option("[$AiCoChunkNay?]");
            pk.setM_Data(chunk);
            System.out.println("Tạo package AiCoChunkNay?");
            try {
                //gửi các broastcast cho các thành viên khác
                sender.sendBroadcast(pk);
            } catch (IOException ex) {
                ex.printStackTrace();
                System.out.println(ex.getMessage());
            }
        }
    }//GEN-LAST:event_bntDownloadActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(BittorrentLike.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(BittorrentLike.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(BittorrentLike.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(BittorrentLike.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new BittorrentLike().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bntCancel;
    private javax.swing.JButton bntCancelOpenTorrent;
    private javax.swing.JButton bntDownAll;
    private javax.swing.JButton bntDownload;
    private javax.swing.JButton bntOpenTorrent;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JList jList1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JButton jbtnBownseOFsharedFile;
    private javax.swing.JButton jbtnJoinToLan;
    private javax.swing.JButton jbtnShareOFsharedFile;
    private javax.swing.JList jlstDownLoad;
    private javax.swing.JList jlstListPeer;
    private javax.swing.JList jlstShared;
    private javax.swing.JPanel jpanDownLoad;
    private javax.swing.JRadioButton radioDownRandom;
    private javax.swing.JRadioButton ridioChonPeer;
    private javax.swing.JTextField txtShare;
    // End of variables declaration//GEN-END:variables
}
